home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / graphics / switchf.arc / aline.h < prev    next >
C/C++ Source or Header  |  1987-08-24  |  27KB  |  562 lines

  1.  
  2.         /***********************************************\
  3.         *                        *
  4.         *                aline.h            *
  5.         *    Common include file for C interface    *
  6.         *    to low level Line A calls        *
  7.         *                        *
  8.         *    J.R. Bammi                *
  9.         *      decvax!cwruecmp!bammi            *
  10.         *      bammi%cwru.edu.CSNET            *
  11.         *      bammi@cwru.edu.ARPA            *
  12.         *      CIS: 71515,155            *
  13.         *                        *
  14.         \***********************************************/
  15.  
  16. #include "compiler.h"        /* Compiler dependent defines    */
  17.  
  18.  
  19. /*****************************************************************************\
  20. *                                                                      *
  21. *                                 Defines                                     *
  22. *                                          *
  23. \*****************************************************************************/
  24.  
  25. /*
  26.  *  Object colors (default pallette)
  27.  *
  28.  */
  29. #define WHITE    0
  30. #define BLACK    1
  31. #define RED      2
  32. #define GREEN    3
  33. #define BLUE     4
  34. #define CYAN     5
  35. #define YELLOW   6
  36. #define MAGENTA  7
  37. #define LWHITE   8
  38. #define LBLACK   9
  39. #define LRED     10
  40. #define LGREEN   11
  41. #define LBLUE    12
  42. #define LCYAN    13
  43. #define LYELLOW  14
  44. #define LMAGENTA 15
  45.  
  46.  
  47. /* 
  48.  * Vdi writing modes
  49.  *
  50.  */
  51. #define MD_REPLACE 1
  52. #define MD_TRANS   2
  53. #define MD_XOR     3
  54. #define MD_ERASE   4
  55.  
  56.  
  57. /*
  58.  * Raster Op Codes
  59.  *
  60.  */
  61. #define ALL_WHITE  0
  62. #define S_AND_D    1
  63. #define    S_AND_NOTD 2
  64. #define S_ONLY     3
  65. #define NOTS_AND_D 4
  66. #define    D_ONLY     5
  67. #define S_XOR_D    6
  68. #define S_OR_D     7
  69. #define    NOT_SORD   8
  70. #define    NOT_SXORD  9
  71. #define D_INVERT  10
  72. #define    NOT_D     11
  73. #define    S_OR_NOTD 12
  74. #define NOTS_OR_D 13
  75. #define    NOT_SANDD 14
  76. #define ALL_BLACK 15
  77.  
  78. /*
  79.  * Sprite formats
  80.  *
  81.  */
  82. #define SP_VDI        0
  83. #define SP_XOR        1
  84.  
  85. /*
  86.  * Line A Opcodes
  87.  *
  88.  */
  89. #define    INIT        0
  90. #define PUTPIXEL    1
  91. #define GETPIXEL    2
  92. #define LINE        3
  93. #define HLINE        4
  94. #define RECTANGLE    5
  95. #define FPOLYGON    6
  96. #define BITBLT        7
  97. #define TEXTBLT        8
  98. #define SHOWMOUSE    9
  99. #define HIDEMOUSE    10
  100. #define TRANMOUSE    11
  101. #define USPRITE        12
  102. #define DSPRITE        13
  103. #define CPYRASTER    14
  104. #define FSEEDFILL    15    /* ROM TOS only    */
  105.  
  106.  
  107. /*****************************************************************************\
  108. *                                                                      *
  109. *                                 Types                                       *
  110. *                                          *
  111. \*****************************************************************************/
  112.  
  113.     /*
  114.      * Global Variables at negative offsets from the Line A parameter
  115.      * block address returned by init. (I have no way of telling if this
  116.      * list is complete).
  117.      *
  118.      */
  119. /* Name   Offset  Type    Description                         */
  120. /* --------------------------------------------------------------------------*/
  121. /* V_Y_MAX    -4   W    Max Y pixel value of the screen                 */
  122. /* V_STATUS   -6   W    Text Status byte                     */
  123. /*               Bit    Field        Zero        One         */
  124. /*              0    cursor flash    disabled    enabled         */
  125. /*              1    flash state     off        on         */
  126. /*              2    cursor visible  no        yes          */
  127. /*              3     end of line     no-wrap        wrap         */
  128. /*              4     inverse video   on              off          */
  129. /*                        5     cursor saved    false           true         */
  130. /* V_OFF_AD  -10   L    Font offset table address                 */
  131. /* V_X_MAX   -12   W    Max X pixel value                     */
  132. /* V_FNT_WR  -14   W    Width of Font Form in bytes (see type FONT below)    */
  133. /* V_FNT_ST  -16   W    First font ASCII code (first_ade)             */
  134. /* V_FNT_ND  -18   W    Last  font ASCII code (last_ade )                    */
  135. /* V_FNT_AD  -22   L    Font Form address                     */
  136. /*            Mono Spaced, 8 pixels wide and byte aligned, any ht. */
  137. /* V_CUR_TIM -23   B    Cursor countdown timer                     */
  138. /* V_CUR_CNT -24   B    Cursor flash interval( in frames)             */
  139. /* V_CUR_CY  -26   W    Y cursor position                     */
  140. /* V_CUR_CX  -28   W    X cursor position                     */
  141. /* V_CUR_OFF -30   W    Offset from screen base to first cell (bytes)         */
  142. /* V_CUR_AD  -34   L    Current cursor address                     */
  143. /* V_COL_FG  -36   W    Foreground color index                     */
  144. /* V_COL_BG  -38   W    Background color index                     */
  145. /* V_CEL_WR  -40   W    Offset to next vertical cell (bytes)             */
  146. /* V_CEL_MY  -42   W    Max cells high - 1                     */
  147. /* V_CEL_MX  -44   W    Max cells across - 1                     */
  148. /* V_CEL_HT  -46   W    Cell height in pixels (font form's height)         */
  149. /* --------------------------------------------------------------------------*/
  150.  
  151. /*
  152.  * Atari finally named these variables
  153.  * so here they are
  154.  *
  155.  */
  156. typedef struct {
  157.     WORD    V_CEL_HT;    /* *((WORD  *)((char  *)aline - (char  *)46L)) */
  158.     WORD    V_CEL_MX;    /* *((WORD  *)((char  *)aline - (char  *)44L)) */
  159.     WORD    V_CEL_MY;    /* *((WORD  *)((char  *)aline - (char  *)42L)) */
  160.     WORD    V_CEL_WR;    /* *((WORD  *)((char  *)aline - (char  *)40L)) */
  161.     WORD    V_COL_BG;    /* *((WORD  *)((char  *)aline - (char  *)38L)) */
  162.     WORD    V_COL_FG;    /* *((WORD  *)((char  *)aline - (char  *)36L)) */
  163.     char    *V_CUR_AD;   /* *((char **)((char **)aline - (char **)34L)) */
  164.     WORD    V_CUR_OFF;   /* *((WORD  *)((char  *)aline - (char  *)30L)) */
  165.     WORD    V_CUR_CX;    /* *((WORD  *)((char  *)aline - (char  *)28L)) */
  166.     WORD    V_CUR_CY;    /* *((WORD  *)((char  *)aline - (char  *)26L)) */
  167.     WORD    V_CUR_CNT;   /* *((char  *)((char  *)aline - (char  *)24L)) */
  168. /*    char    V_CUR_TIM;    *((char  *)((char  *)aline - (char  *)23L))   */
  169.     char    **V_FNT_AD;  /* *((char **)((char **)aline - (char **)22L)) */
  170.     WORD    V_FNT_ND;    /* *((WORD  *)((char  *)aline - (char  *)18L)) */
  171.     WORD    V_FNT_ST;    /* *((WORD  *)((char  *)aline - (char  *)16L)) */
  172.     WORD    V_FNT_WR;    /* *((WORD  *)((char  *)aline - (char  *)14L)) */
  173.     WORD    V_X_MAX;     /* *((WORD  *)((char  *)aline - (char  *)12L)) */
  174.     char    **V_OFF_AD;  /* *((char **)((char **)aline - (char **)10L)) */
  175.     WORD    V_STATUS;    /* *((WORD  *)((char  *)aline - (char  *) 6L)) */
  176.     WORD    V_Y_MAX;     /* *((WORD  *)((char  *)aline - (char  *) 4L)) */
  177.     WORD    xxdummy;     /* *((WORD  *)((char  *)aline - (char  *) 2L)) */
  178. } NLINEA;
  179.  
  180.  
  181.     /* A pointer to the type LINEA is returned by the Line A init call
  182.      * ($A000), in registers A0 and D0.
  183.          * This pointer is saved in the global variable 'aline'.
  184.      *
  185.      */
  186. typedef struct {
  187.  
  188. /* Type    Name       Offset   Function            Comments             */
  189. /* ------------------------------------------------------------------------- */
  190.    WORD   VPLANES;    /*  0  # of Planes     Also see CurrRez            */
  191.    WORD      VWRAP;      /*  2  Bytes / scan line    "    "    "                */
  192.               /*     VWRAP can be changed to implement special effect*/
  193.               /*     Doubling VWRAP will skip every other scan line  */
  194.               /*                                 */
  195.               /*                                                     */
  196.    WORD      *CONTRL;    /*  4  Ptr to CONTRL Array  Contrl gets set to this    */
  197.    WORD      *INTIN;     /*  8  Ptr to INTIN  Array  Intin  gets set to this    */
  198.    WORD      *PTSIN;     /* 12  Ptr to PTSIN  Array  Ptsin  gets set to this    */
  199.    WORD   *INTOUT;    /* 16  Ptr to INTOUT Array  Intout gets set to this    */
  200.    WORD   *PTSOUT;    /* 20  Ptr to PTSOUT Array  Ptsout gets set to this    */
  201.               /*     CONTRL is the control array             */
  202.               /*     INTIN is the array of input parameters         */
  203.               /*     PTSIN is the array of input coordinates         */
  204.               /*      Even entrys are X coordinate             */
  205.               /*       Odd  entrys are corresponding Y coodinates */
  206.               /*     INTOUT is the array of output parameters        */
  207.               /*     PTSOUT is the array of output coordinates       */
  208.               /*    organizes like PTSIN.                 */
  209.               /*                                 */
  210.    WORD   COLBIT0;    /* 24  Plane 0 Color Value  All Three Rez's         */
  211.    WORD   COLBIT1;    /* 26  Plane 1 Color Value  Med and Low Rez only         */
  212.    WORD      COLBIT2;    /* 28  Plane 2 Color Value  Low Rez only              */
  213.    WORD   COLBIT3;    /* 30  Plane 3 Color Value  Low Rez Only              */
  214.               /*     Foreground color COLBIT0 + 2*COLBIT1 + 4*COLBIT2*/
  215.               /*                  + 8*COLBIT3             */
  216.               /*                                 */
  217.               /*                                                     */
  218.    WORD      LSTLIN;     /* 32  Always set to -1, Done for you in init_aline()  */
  219.               /*     Does anyone know what it is supposed to be?     */
  220.               /*